'use strict';

webappApp.filter('elide', function () {
  return function (input, maxLength) {
    var  str = $.trim(input || ''),
      length = Math.min(str.length, (maxLength || 20)),
      ellided = str.substring(0, length);
      if (str.length < maxLength) {
        return str;
      } else {
        return ellided.length ? $.trim(ellided) + '...' : ellided;
      }
  };
});